import React, {Component} from 'react';
import styles from './index.less';
import classNames from 'classnames';
import {
  Button
} from 'antd';


export default class ButtonComponent extends Component {
  constructor(props) {

    //const style = this.props.style;

    super(props);
  }
  render() {
    let {children ,style,className } =this.props;
    if (typeof(children) === 'string'){
      if(!style) style = {}
      //console.log(children);
      if (children.length<4){
        style.width = "80px";
      }else if (children.length>=5) {
        style.width = (56+10*children.length)+"px";
      }
    }
    const classContent = classNames(styles.button, {
      [className]: className,
    })
    return <Button
      {...this.props}
      className = {classContent}
      style={style}

    > {children}</Button>;
  }
}
